<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class ApplianceController extends CI_Controller {

	function __construct()
	{
		parent::__construct();
		$this->load->helper('url');
	}
	
	function loadAddApplianceView()
	{
		$this->load->view('AddApplianceView');
	}
	
	function addAppliance()
	{
		$this->load->model('Appliance_model');
		$this->Appliance_model->add_appliance($_POST);
		redirect('adminPageController');
	}
	
	function loadApplianceToEditView()
	{
		$this->load->view('ApplianceToEditView');
	}
	
	function loadEditApplianceView()
	{
		$this->load->model('Appliance_model');
		$sql['data'] = $this->Appliance_model->check_appliance($_POST);
		$this->load->view('EditApplianceView',$sql);
	}
	
	function editAppliance()
	{
		$this->load->model('Appliance_model');
		$this->Appliance_model->edit_appliance($_POST);
		redirect('adminPageController');
	}
	
	function loadApplianceToSearchView()
	{
		$this->load->view('ApplianceToSearchView');
	}
	
	function loadSearchApplianceView()
	{
		$this->load->model('Appliance_model');
		$sql['data'] = $this->Appliance_model->check_appliance($_POST);
		$this->load->view('SearchApplianceView',$sql);
	}
	
	function loadDeleteApplianceView()
	{
		$this->load->model('Appliance_model');
		$sql['data'] = $this->Appliance_model->get_all_appliance($_POST);
		$this->load->view('DeleteApplianceView',$sql);
	}
	
	function deleteAppliance()
	{
		$this->load->model('Appliance_model');
		$sql['data'] = $this->Appliance_model->delete_appliance($_POST);
		redirect('applianceController/loadDeleteApplianceView');
	}
	
	function loadDeleteAllAppliancesView()
	{
		$this->load->model('Appliance_model');
		$sql['data'] = $this->Appliance_model->get_all_appliances($_POST);
		$this->load->view('DeleteAllAppliancesView',$sql);
	}
	
	function deleteAllAppliances()
	{
		$this->load->model('Appliance_model');
		$this->Appliance_model->delete_all_appliances($_POST);
		redirect('adminPageController');
	}
	
}

/* End of file applianceController.php */
/* Location: ./application/controllers/applianceController.php */
?>